<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    .title {
      position: relative;
      height: 50px;
      font-size: 40px;
      cursor: pointer;
      width: auto;
    }
    .title:before,.title:after {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      height: 2px;
      background-color: #fc2f70;
      transform: scaleX(0);
      transition: transform .5s ease;
    }
    .title:before {
      top: 0;
      transform-origin: center right;
    }
    .title:hover::before {
      transform-origin: center left;
      transform: scaleX(1);
    }

    .title::after {
        bottom: 0;
        transform-origin: center left;
    }
    .title:hover::after {
        transform-origin: center right;
        transform: scaleX(1);
    }
  </style>
</head>
<body>
  <span class="title">Hello World</span>
</body>
</html>